import paddleocr
import numpy as np

from PIL import Image


if __name__ == '__main__':
    img_path = 'data/test.png'

    img_pil = Image.open(img_path)
    img_np = np.array(img_pil)

    # 如果是rgba图片，则只取rgb三通道
    if img_np.shape[-1] == 4:
        img_np = img_np[:, :, :3]

    print (img_np.shape)

    result = paddleocr.predict(img_np)

    print (result)